<?php
/**
 * Created by PhpStorm.
 * User: Lenovo
 * Date: 2019/4/27
 * Time: 22:22
 */

namespace app\api\model;


class Tixian extends BaseModel
{
    protected $table='jc_withdrawal';
    public function tixian($uid)
    {
        $rs=$this->where('uid',$uid)->field('wid,w_money,w_createtime,qid,w_state')->select();
        foreach ($rs as $k=>$v)
        {
            if($v['w_state'] == 1){
                $v['w_state'] = "待审核";
            }elseif($v['w_state'] == 2){
                $v['w_state'] = "已通过";
            }elseif($v['w_state'] == 3){
                $v['w_state'] = "已驳回";
            }
            $qid=$v['qid'];
            if($v['qid']==0)
            {
                $rs[$k]['type']='银行卡';
            }
            else
            {
                $qid=QrcodeModel::where('qid',$qid)->find();
                $ztype=Zpaytype::where('zid',$qid['zid'])->find();
                $rs[$k]['type']=$ztype['z_type'];
            }
        }
        if(empty($rs))
        {
            $rs=array();
        }
        return $rs;
    }
}